package ru.st.selenium.applogic2;

import java.util.List;

import ru.st.selenium.applogic.FilmHelper;
import ru.st.selenium.model.Film;
import ru.st.selenium.model.User;
import ru.st.selenium.pages.AddFilmPage;
//import ru.st.selenium.pages.UserProfilePage;

public class FilmHelper2 extends DriverBasedHelper implements FilmHelper {

	  public FilmHelper2(ApplicationManager2 manager) {
	    super(manager.getWebDriver());
	  }

	  @Override
	  public void create(Film film) {
		    pages.internalPage.clickAddFilmLink().ensurePageLoaded()
		    .setImdbidField(film.getImdb())
		    .setNameField(film.getTitle())
		    .setNotesField(film.getNotes())
		    .setYearField(film.getYear())
		    .clickSubmitButton();
	 
	  }
	  
	  @Override
	  public boolean isCreate(){
		  return pages.filmOverviewPage.waitPageLoaded();
	  }
	  
	  @Override
	  public boolean isNotCreate(){
		  return pages.addFilmPage.waitPageLoaded();
	  }
	  

	  @Override
	  public void delete(Film film) {
	    // TODO Auto-generated method stub
		  pages.internalPage.clickFilmLink().ensurePageLoaded()
		  .clickRemoveButton();
		 
	  }
	  
	  

	  @Override
	  public List<Film> search(String title) {
	   	  pages.internalPage.ensurePageLoaded()
	   	  .clickSearchField()
	   	  .setSearchField(title)
	   	  .ensurePageLoaded();
	    return null;
	  }

	}
